﻿@section PageTitle { Content Aware Resize Filter }

<p class="summary">Install the <a href="http://nuget.org/packages/DynamicImage.Extensions.ContentAwareResizing/">DynamicImage.Extensions.ContentAwareResizing</a> package to get this extension.
	There is some background information in <a href="http://timjones.tw/blog/archive/2010/12/03/content-aware-image-resizing-for-aspnet">this blog post</a>.
</p>

<pre class="prettyprint">
@@Html.DynamicImageTag(b => b.WithLayer(
	LayerBuilder.Image.SourceFile("~/Assets/Images/tower.jpg")
		.WithFilter(FilterBuilder.Resize.ToWidth(500))
))
</pre>

<p>
	@Html.DynamicImageTag(b => b.WithLayer(
		LayerBuilder.Image.SourceFile("~/Assets/Images/tower.jpg")
			.WithFilter(FilterBuilder.Resize.ToWidth(500))
	))
</p>

<pre class="prettyprint">
@@Html.DynamicImageTag(b => b.WithLayer(
	LayerBuilder.Image.SourceFile("~/Assets/Images/tower.jpg")
		.WithFilter(FilterBuilder.Resize.ToWidth(500))
		.WithFilter(FilterBuilder.Resize.To(350, 412, ResizeMode.Fill))
))
</pre>

<p>
	@Html.DynamicImageTag(b => b.WithLayer(
		LayerBuilder.Image.SourceFile("~/Assets/Images/tower.jpg")
			.WithFilter(FilterBuilder.Resize.ToWidth(500))
			.WithFilter(FilterBuilder.Resize.To(350, 412, ResizeMode.Fill))
	))
</p>

<pre class="prettyprint">
@@Html.DynamicImageTag(b => b.WithLayer(
	LayerBuilder.Image.SourceFile("~/Assets/Images/tower.jpg")
		.WithFilter(FilterBuilder.Resize.ToWidth(500))
		.WithFilter(new ContentAwareResizeFilterBuilder().ToWidth(350)
			.ConvolutionType(ContentAwareResizeFilterConvolutionType.V1))
))
</pre>

<p>
	@Html.DynamicImageTag(b => b.WithLayer(
		LayerBuilder.Image.SourceFile("~/Assets/Images/tower.jpg")
			.WithFilter(FilterBuilder.Resize.ToWidth(500))
			.WithFilter(new ContentAwareResizeFilterBuilder().ToWidth(350).ConvolutionType(ContentAwareResizeFilterConvolutionType.V1))
	))
</p>